package satir.player;

import java.util.ArrayList;

import satir.card.*;
import satir.cell.*;

/**
 * The Class Player.
 * 
 * @version 1.0 March 2012
 * @author Bill Chan
 */
public class Player {
	
	/** The name. */
	private String name;
	
	/** The figure. */
	private char figure;//remark	
	
	/** The role. */
	private RoleCard role;
	
	/** The self esteem. */
	private int selfEsteem;
	
	/** The current cell. */
	private Cell currentCell;
	
	/** The mt cards. */
	private ArrayList<MagicToolCard> mtCards;	
	
	/**
	 * Instantiates a new player.
	 */
	public Player() {
		name="default";
		selfEsteem=5;
		mtCards = new ArrayList<MagicToolCard>();
	}
	
	/**
	 * Instantiates a new player.
	 *
	 * @param name the name
	 * @param figure the figure
	 * @param currentCell the current cell
	 */
	public Player(String name, char figure, Cell currentCell) {
		this.name=name;
		this.figure=figure;
		this.currentCell=currentCell;
		this.currentCell.addPlayer(this);
		selfEsteem=5;
		mtCards = new ArrayList<MagicToolCard>();	
		
	}
	
	
	/**
	 * Sets the role.
	 *
	 * @param role the new role
	 */
	public void setRole(RoleCard role) {
		this.role= role;
	}
	
	/**
	 * Gets the role.
	 *
	 * @return the role
	 */
	public RoleCard getRole() {
		return role;
	}
	
	/**
	 * Sets the name.
	 *
	 * @param name the new name
	 */
	public void setName(String name) {
		this.name=name;
	}
	
	/**
	 * Gets the name.
	 *
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * Sets the figure.
	 *
	 * @param figure the new figure
	 */
	public void setFigure(char figure){
		this.figure=figure;
	}
	
	/**
	 * Gets the figure.
	 *
	 * @return the figure
	 */
	public char getFigure(){
		return figure;
	}
		
	/**
	 * Adds the movement.
	 *
	 * @param addMovement the add movement
	 */
	public void addMovement(int addMovement){
		currentCell.removePlayer(this);
		for(int i=0; i<addMovement; i++)
			currentCell = currentCell.getNextCell();
		currentCell.addPlayer(this);
		
	}
	
	/**
	 * Sets the current cell.
	 *
	 * @param currentCell the new current cell
	 */
	public void setCurrentCell(Cell currentCell){
		this.currentCell=currentCell;
	}
	
	/**
	 * Gets the current cell.
	 *
	 * @return the current cell
	 */
	public Cell getCurrentCell(){
		return currentCell;
	}
	
	/**
	 * Increase self esteem.
	 *
	 * @param increaseValue the increase value
	 */
	public void increaseSelfEsteem(int increaseValue){
		selfEsteem+=increaseValue;
	}
	
	/**
	 * Decrease self esteem.
	 *
	 * @param decreaseValue the decrease value
	 */
	public void decreaseSelfEsteem(int decreaseValue){
		selfEsteem-=decreaseValue;
	}


	/**
	 * Sets the self esteem.
	 *
	 * @param selfEsteem the new self esteem
	 */
	public void setSelfEsteem(int selfEsteem) {
		if(selfEsteem<0 || selfEsteem>10)
			this.selfEsteem=0;
		else
			this.selfEsteem=selfEsteem;
	}

	/**
	 * Gets the self esteem.
	 *
	 * @return the self esteem
	 */
	public int getSelfEsteem() {
		return selfEsteem;
	}

	/**
	 * Roll dice.
	 */
	public void rollDice() {
		throw new UnsupportedOperationException();
	}

	/**
	 * Move.
	 *
	 * @param step the step
	 * @return the int
	 */
	public int move(int step) {
		throw new UnsupportedOperationException();
	}

	/**
	 * Use tool.
	 */
	public void useTool() {
		throw new UnsupportedOperationException();
	}
	
	/**
	 * Sets the mt cards.
	 *
	 * @param mtCard the new mt cards
	 */
	public void setMtCards(MagicToolCard mtCard){
		this.mtCards.add(mtCard);
	}
	
	/**
	 * Removes the mt card.
	 *
	 * @param mtCard the mt card
	 */
	public void removeMtCard(MagicToolCard mtCard){
		this.mtCards.remove(mtCard);
	}
	
	/**
	 * Gets the mt cards.
	 *
	 * @return the mt cards
	 */
	public ArrayList<MagicToolCard> getMtCards(){
		return this.mtCards;
	}
}